home *** CD-ROM | disk | FTP | other *** search
Wrap
property enabled, membermin, membermax, ImageCastLib, CycleStyle, goingDown, CurrentState, numstates, name on CycleState me, name if name = the name of me then bumpstate_intern(me) end if end on setstate me, statenum if the enabled of me then if statenum > the numstates of me then set statenum to the numstates of me else if statenum < 1 then set statenum to 1 end if end if set the member of sprite the spriteNum of me to member (the membermin of me + statenum - 1) of castLib ImageCastLib end if end on setGoingDown me, value set the goingDown of me to value end on SetCycleStyle me, value set the CycleStyle of me to value end on bumpstate_intern me if the enabled of me then if the CycleStyle of me = #repeat then if not (the goingDown of me) then set curr to the CurrentState of me + 1 if curr > the numstates of me then set curr to 1 end if else set curr to the CurrentState of me - 1 if curr < 1 then set curr to the numstates of me end if end if else if not (the goingDown of me) then set curr to the CurrentState of me + 1 if curr > the numstates of me then set curr to curr - 2 set the goingDown of me to 1 end if else set curr to the CurrentState of me - 1 if curr < 1 then set curr to 2 set the goingDown of me to 0 end if end if end if set the CurrentState of me to curr setstate(me, curr) end if end on beginSprite me puppetSprite(the spriteNum of me, 1) set the enabled of me to 1 set membermin to the memberNum of member membermin set membermax to the memberNum of member membermax set the numstates of me to the membermax of me - the membermin of me + 1 set the CurrentState of me to the memberNum of sprite the spriteNum of me - the membermin of me + 1 set the ImageCastLib of me to the number of castLib the castLibNum of sprite the spriteNum of me setstate(me, the CurrentState of me) end on endSprite me puppetSprite(the spriteNum of me, 0) end on getPropertyDescriptionList set description to [:] if the currentSpriteNum = 0 then set slidedefault to 0 else set memref to the member of sprite the currentSpriteNum set castLibNum to the castLibNum of memref set slidedefault to member the memberNum of member memref of castLib castLibNum end if addProp(description, #name, [#comment: "Item Name:", #format: #symbol, #default: #MultiState_1]) addProp(description, #membermin, [#comment: "First Image:", #format: #member, #default: slidedefault]) addProp(description, #membermax, [#comment: "Last Image:", #format: #member, #default: slidedefault]) addProp(description, #CycleStyle, [#comment: "Cycle Style:", #format: #symbol, #range: [#repeat, #Reverse], #default: #repeat]) addProp(description, #goingDown, [#comment: "Reverse Order:", #format: #boolean, #default: 0]) return description end on getBehaviorDescription return "Prepares a sprite to use a Series of adjacent Bitmap castmembers to represent an set of mutually exclusive states that the user can cycle through. See below for usage. " & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Item Name - ( optional ) name of this control." & RETURN & "ΓÇó First Image - number of first castmember in the sequence." & RETURN & "ΓÇó Last Image - number of last castmember in the sequence." & RETURN & "ΓÇó Cycle Mode - specifies how images in cycle are repeated on subsequent iterations. The Repeat mode repeats the same sequence. The Reverse mode cycles back through the sequence in reverse order." & RETURN & "ΓÇó Reverse Order - proceed from last to first image by default." & RETURN & "MESSAGES:" & RETURN & "ΓÇó CycleState - advance to the next image in the sequence, or the previous image, if the GoingDown property is true. & RETURN & "ΓÇó SetState state_number - advance directly to position state_number in the sequence." end on getAssocMembers set myPropList to [] repeat with x = membermin + 1 to membermax add(myPropList, member x of castLib ImageCastLib) end repeat return myPropList end